package com.cdsxt.genCode.main;

import javax.annotation.PostConstruct;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;

import com.cdsxt.genCode.service.GenCodeService;
import com.cdsxt.genCode.vo.GenCodeModuleVo;

@SpringBootApplication
@MapperScan("com.cdsxt.genCode.dao")
@ComponentScan("com.cdsxt.genCode.service")
public class SartGenCodeForDb {
	
	public static void main(String[] args) {
		SpringApplication.run(SartGenCodeForDb.class, args);
	}
	
	@Autowired
	private GenCodeService genCodeService;
	/**
	 * 生成代码
	 */
	@PostConstruct
	public void genCode() {
		//删除原来的
		genCodeService.deleteGenCode();
		//得到所有的模块：只传入业务数据
		GenCodeModuleVo[] mdArr = genCodeService.getConnectedDataBaseListModule();
		//模块产生代码
		genCodeService.genModuleCode1Arr(mdArr);;
		System.out.println("【生成代码完成】");
		//退出程序
		System.exit(0);
	}
}
